window.onload = function () {


    // 获取查列表
    let tealist = document.getElementsByClassName("SixTea")[0];
    $.ajax({
        type: "post",
        url: "/js/huixianshouye",
        data: null,
        dataType: "json",
        success: function (data) {
            let s = "";
            for (let i = data.length - 6; i < data.length; i++) {
                id = data[i].id;
                teaName = data[i].teaName;
                teaType = data[i].teaType;
                teaPrice = data[i].teaPrice;
                teaImg = data[i].teaImg;
                s += `<div class="SixTea1">`
                s += `<div class="SixTea1img"><img src="../img/${teaImg}" alt=""></div>`
                s += `<div class="SixTea1title1">${teaName}</div>`
                s += `<div class="SixTea1title11"></div>`
                s += `<div class="SixTea1title2">￥${teaPrice}</div>`
                s += `</div>`
            }
            tealist.innerHTML = s;
        }
    })


    let sixtea = document.getElementById("SixTea");
    
    window.addEventListener('scroll', function () {
        //documentElement.scrollTop专门用来获取右侧滚动条到页面顶部的距离
        let top = document.documentElement.scrollTop;
        if (top > 400) {
            sixtea.style.animation = "SixTea 1s linear forwards"
        }
    })
}